package com.gomyb.admin.module.product.model;

import com.gomyb.common.base.BaseModel;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * @author <a href="mailto:hellohesir@gmail.com">Mr_He</a>
 */
@Entity
@Table(name = "app_product")
@Getter
@Setter
@DynamicUpdate
@DynamicInsert
public class AppProduct extends BaseModel {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "name")
    private String name;    //产品名称

    @Column(name = "model")
    private String model;   //规格

    @Column(name = "each_count")
    private BigDecimal eachCount;   //每件多少个

    @Column(name = "wholesale_in")
    private BigDecimal wholesaleIn;    //进价

    @Column(name = "wholesale_out")
    private BigDecimal wholesaleOut;   //批发价

    @Column(name = "retail_price")
    private BigDecimal retailPrice;    //零售价

    @Column(name = "category_id")
    private Long categoryId;    //类别对象

    @Transient
    private String categoryName;

    public AppProduct() {
    }

    public AppProduct(Long id, String name, String model, BigDecimal eachCount, BigDecimal wholesaleIn, BigDecimal wholesaleOut, BigDecimal retailPrice, Long categoryId, String categoryName) {
        this.id = id;
        this.name = name;
        this.model = model;
        this.eachCount = eachCount;
        this.wholesaleIn = wholesaleIn;
        this.wholesaleOut = wholesaleOut;
        this.retailPrice = retailPrice;
        this.categoryId = categoryId;
        this.categoryName = categoryName;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
}
